package com.ty.day5;

import java.util.Arrays;

/**
 * Created by IntelliJ IDEA.
 *
 * @author : txy
 * @create : 2023/11/10 15:33
 */
public class Five {
    public static void main(String[] args) {
        int[] a ={1,2,3,6,5,4,7,8,10,9};
        int max = a[0];
        for (int i = 1; i < a.length; i++) {
            if (max < a[i]) {
                max = a[i];
            }
        }
        int[] b=new int[a.length+1];
        b[b.length-1]=max;
        System.arraycopy(a,0,b,0,a.length);
        System.out.println(Arrays.toString(b));
        a = new int[]{1, 2, 3, 6, 5, 4, 7, 8, 10, 9};
        int[] e =new int[0];
        int k=0;
        for (int i:a){
            if (i%2==0){
                e=Arrays.copyOf(e,e.length+1);
                e[k++]=i;
            }
        }
        System.out.println(Arrays.toString(e));
    }
}
